package com.regent.central.bill.service.bean;

import com.regent.central.bill.core.ReturnGoods;
import com.regent.central.bill.repository.ReturnGoodsMapper;
import com.regent.central.bill.service.ReturnGoodsService;
import com.regent.central.infrastructure.service.bean.DomainServiceBean;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReturnGoodsServiceBean extends DomainServiceBean<ReturnGoodsMapper, ReturnGoods> implements ReturnGoodsService {
    /**
     * 删除退货货品
     *
     * @param returnGoodsId 退货货品ID
     * @param userDeleted   删除人
     */
    @Override
    public void delete(String returnGoodsId, String userDeleted) {
        mapper.hide(returnGoodsId, userDeleted, System.currentTimeMillis());
    }

    /**
     * 根据退货动作ID删除退货货品
     *
     * @param returnActionId 退货动作ID
     * @param userDeleted    删除人
     */
    @Override
    public void deleteForSaleOrderReturnAction(String returnActionId, String userDeleted) {
        mapper.deleteForSaleOrderReturnAction(returnActionId, userDeleted, System.currentTimeMillis());
    }

    /**
     * /**
     * 获取销售单的退货货品
     *
     * @param saleOrderId 销售单ID
     * @return 销售单的退货货品
     */
    @Override
    public List<ReturnGoods> getSaleOrderReturnGoods(String saleOrderId) {
        return getSaleOrderReturnGoods(saleOrderId, false, false);
    }

    /**
     * /**
     * 获取销售单的退货货品
     *
     * @param saleOrderId 销售单ID
     * @param canceled    已撤销
     * @param deleted     已删除
     * @return 销售单的退货货品
     */
    @Override
    public List<ReturnGoods> getSaleOrderReturnGoods(String saleOrderId, Boolean canceled, Boolean deleted) {
        return mapper.getSaleOrderReturnGoods(saleOrderId, canceled, deleted);
    }
}